package com.martini.common.domain;

import com.martini.common.enumeration.StatusCodeEnum;
import lombok.Data;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * @author martini at 2021/10/10 22:53
 */
@Data
@Accessors(chain = true)
public class R {

    private int code;
    private String msg;
    private Object data;

    public static R success() {
        return new R().setMsg(StatusCodeEnum.OK.getMsg()).setCode(StatusCodeEnum.OK.getCode());
    }

    public static R fail() {
        return new R().setMsg(StatusCodeEnum.FAIL.getMsg()).setCode(StatusCodeEnum.FAIL.getCode());
    }

}
